import java.awt.*;
import java.awt.event.*;
/**
 * La clase ZeroReturnMode establece componentes
 * para posicionar automáticamente el husillo en la posición 
 * cero máquina. Permite ver la posición actual, estado del 
 * husillo, la velocidad de avance, cero pieza, opciones
 * de las herramientas y el estado de los interruptores límite.
 */
public class ZeroReturnMode extends Mode
{
    public ZeroReturnMode()
    {
        super(
            "zeroReturnMode",
            KbdCmdId.CmdValue.MODE_HOME
        );
    }
    public void setDescriptionViewPanel()
    {
        addTopPanels(
            "currentPosition",
            Mode.Place.WEST,
            new GridBagConstraints(
                0,
                0,
                1,
                1,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[]{
                Data.Id.AXIS_CURRENT_POSITION
            },
            null
        );
        addTopPanels(
            "programZero",
            Mode.Place.CENTER,
            new GridBagConstraints(
                0,
                0,
                1,
                1,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.PROGRAM_ZERO
            },
            null
        );
        addTopPanels(
            "spindle",
            Mode.Place.WEST,
            new GridBagConstraints(
                0,
                1,
                1,
                1,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.SPINDLE
            },
            null
        );
        addTopPanels(
            "feedrate",
            Mode.Place.WEST,
            new GridBagConstraints(
                0,
                2,
                1,
                1,  
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.FEEDRATE
            },
            null
        );
        addTopPanels(
            "state",
            Mode.Place.CENTER,
            new GridBagConstraints(
                1,
                0,
                1,
                2,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
                ),
            new Data.Id[] {
                Data.Id.AXIS_LIMIT_SWITCH
            },
            null
        );
        addTopPanels(
            "tool",
            Mode.Place.CENTER,
            new GridBagConstraints(
                0,
                1,
                1,
                1,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.TOOL_MAGAZINE_CAPACITY,
                Data.Id.MAXIMUM_TOOL_INDEX,
                Data.Id.TOOL_SELECTION_TYPE,
                Data.Id.SELECTED_TOOL_INDEX,
                Data.Id.NEXT_TOOL_INDEX
            },
            null
        );
        addTopPanels(
            "operationMode",
            Mode.Place.NORTH,
            new GridBagConstraints(
                0,
                0,
                1,
                1,
                1,
                1,
                GridBagConstraints.CENTER,
                GridBagConstraints.BOTH,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.OPERATION_MODE
            },
            null
        );
        addTopPanels(
            "emergencyStop",
            Mode.Place.NORTH,
            new GridBagConstraints(
                1,
                0,
                1,
                1,
                0,
                0,
                GridBagConstraints.EAST,
                GridBagConstraints.NONE,
                new Insets(0, 0, 0, 0),
                0,
                0
            ),
            new Data.Id[] {
                Data.Id.EMERGENCY_STOP
            },
            null
        );
    }
    public void setDescriptionEditablePanel()
    {
        addBottomPanels(
            "axisMotion",
            Mode.Place.CENTER,
            new Data.Id[] {
                Data.Id.OTHER,
                Data.Id.ZERO_RETURN,
                Data.Id.OTHER,
                Data.Id.OTHER,
                Data.Id.OTHER,
                Data.Id.OTHER
            },
            new AnotherComponent[] {
                AnotherComponent.PANEL,
                AnotherComponent.PANEL,
                AnotherComponent.PANEL,
                AnotherComponent.PANEL,
                AnotherComponent.PANEL
            },
            new GridLayout(2,3)
        );
    }
}
